<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>扯蛋</title>
    <meta name="viewport" content="initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-touch-fullscreen" content="YES">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <!--页面共同的CSS，JS-->
    <script src="../../res/js/common/commonCssJS.js"></script>
    <link rel="stylesheet" href="../../res/css/pullEgg/pullEggDetail.css?v=1.0.3">
    <style>
        .minirefresh-upwrap{
            display: none;
        }
    </style>
</head>

<body>
<section class="index">
    <!--评论列表-->
    <section class="indexComment">
        <div id="mrefresh" class="minirefresh-wrap">
            <!--页面内容-->
            <section class="indexContent">
                <div class="communityUser">
                    <div class="communityUserPic">
                        <img id="userface" src="" alt="">

                    </div>
                    <div id="usernick" class="communityUserName">
                        <p>
                            <span id="userName"></span>
                            <img id="uservip" src="../../res/img/eggTV/monthCard@2x.png" alt="">
                            <img id="chenghaoImg" src="" alt="">
                        </p>
                        <p id="outtime"></p>
                    </div>
                </div>
                <div class="content1">
                    <p id="intro" class="info"></p>
                    <div id="infoImg" class="infoImg"></div>
                </div>
            </section>
            <div class="indexPLTab">
                <div class="tabTitle">
                    <div class="tabLi active">
                        <div>评论 <span id="plNum">0</span></div>
                        <div class="activeLine"></div>
                    </div>
                    <div class="tabLi">
                        <div>赞 <span id="dzNum">0</span></div>
                        <div class="activeLine"></div>
                    </div>
                </div>
                <div class="tabContent">
                    <div class="minirefresh-scroll">
                        <ul id="commentList"></ul>
                        <div class="noplList nopl">
                            <div class="noplListContent">
                                <img src="../../res/img/pullEgg/nopl.png" alt="">
                                <p>快来发表你的评论吧~</p>
                            </div>
                        </div>
                    </div>
                    <div class="indexLike">
                        <ul id="likeList"></ul>
                        <div class="noplList nodz">
                            <div class="noplListContent">
                                <img src="../../res/img/pullEgg/nopl.png" alt="">
                                <p>还没有人赞过哦~</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--点赞-->


            <section id="delete" class="delete"><span>删除本帖</span></section>
        </div>

    </section>
</section>

<div class="operation">
    <div id="commentbtn" class="comment">
        <img src="../../res/img/pullEgg/pl1.png" alt="">
        <span class="plcountBtn">评论</span>
    </div>
    <div id="likeBtn" class="like">
        <img src="../../res/img/pullEgg/dz1.png" alt="">
        <span class="zancountBtn">点赞</span>
    </div>
</div>

<!--评论弹窗-->
<section class="guaXD animated">
    <header>评论</header>

    <div class="content1">
        <textarea id="intro1" name="intro" maxlength="120"></textarea>
    </div>
    <div class="btn">
        <div id="liuYan" class="gm">评论</div>
        <div class="qx">取消</div>
    </div>
</section>
</body>
<script src="../../res/js/pullEgg/md5.js"></script>
<script src="../../res/js/pullEgg/previewImage.min.js"></script>
<script src="../../res/js/pullEgg/pullEggDetail.js?v=1.0.5" ></script>
<script>
    let $wrap = {};
    /**
     * get multiple elements
     * @public
     */
    $wrap.all = function(selector, contextElement) {
        let nodeList,
            list = [];
        if (contextElement) {
            nodeList = contextElement.querySelectorAll(selector);
        } else {
            nodeList = document.querySelectorAll(selector);
        }
        if (nodeList && nodeList.length > 0) {
            list = Array.prototype.slice.call(nodeList);
        }
        return list;
    }

    /**
     * delegate an event to a parent element
     * @public
     * @param  array     $el        parent element
     * @param  string    eventType  name of the event
     * @param  string    selector   target's selector
     * @param  function  fn
     */
    $wrap.delegate = function($el, eventType, selector, fn) {
        if (!$el) { return; }
        $el.addEventListener(eventType, function(e) {
            let targets = $wrap.all(selector, $el);
            if (!targets) {
                return;
            }
            // findTarget:
            for (let i=0; i<targets.length; i++) {
                let $node = e.target;
                while ($node) {
                    if ($node == targets[i]) {
                        fn.call($node, e);
                        break; //findTarget;
                    }
                    $node = $node.parentNode;
                    if ($node == $el) {
                        break;
                    }
                }
            }
        }, false);
    };

    let urls = [];
    let imgs;

    $wrap.delegate(document.querySelector('#infoImg'), 'click','img',function(){
        let current = this.src.substring(0,this.src.length-10);
        let obj = {
            urls : urls,
            current : current
        };
        previewImage.start(obj);
    });

</script>
</html>
